home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2000 June (IDG) / Macworld_June_2000.iso / Shareware World / Utilities / Printing / MacGhostView / ps2ascii script < prev    next >
Encoding:
Text File  |  2000-03-30  |  1.2 KB  |  33 lines  |  [TEXT/ToyS]

  1. -- Save this script as an application and then drop a postscript file on it.
  2.  
  3.  
  4. on open (theList)
  5.     repeat with afile in theList
  6.         set old_delimits to AppleScript's text item delimiters
  7.         set AppleScript's text item delimiters to ":"
  8.         -- pull the path out as a string and strip off the filename
  9.         set path_text to (afile as text)
  10.         set path_list to (text items of path_text)
  11.         set final_path to items 1 thru ((count of path_list) - 1) of path_list
  12.         set infile to last item of path_list
  13.         set working_directory to (final_path as string) & ":"
  14.         set AppleScript's text item delimiters to "."
  15.         set file_text to (text items of infile)
  16.         set basename to item 1 of file_text
  17.         set AppleScript's text item delimiters to old_delimits
  18.         set outfile to basename & ".txt"
  19.         set command to "gs -q -dNODISPLAY -dNOBIND -dWRITESYSTEMDICT -dSIMPLE -c save -f ps2ascii.ps" & space & infile & " -c quit > " & outfile
  20.         tell application "ps2pdf"
  21.             activate
  22.             set status to (exec command in the folder alias working_directory)
  23.             if status = 0 then
  24.                 tell application "Finder"
  25.                     set creator type of file (working_directory & outfile) to "ttxt"
  26.                     set file type of file (working_directory & outfile) to "TEXT"
  27.                 end tell
  28.                 quit
  29.             end if
  30.         end tell
  31.     end repeat
  32. end open
  33.